export const DIALOG_OPTIONS = {
  visible: false,
  title: 'title',
  width: '70%',
  is: '',
  fullscreen: false
}

export default {
  data() {
    return {
      dialogOptions: {
        ...DIALOG_OPTIONS
      },
    }
  },
  methods: {
    openDialog(ops) {
      if(!ops.hasOwnProperty('closeModal')) {
        ops.closeModal = false
      }
      this.dialogOptions = Object.assign(this.dialogOptions, ops)
      this.$emit('update:visible', true)
      this.show = true
    },
    showDialog(ops = {}) {
      if(!this.selectedList.length) {
        this.$message.warning("缺少批量执行的工单数据！");
        return
      }
      if(!ops.hasOwnProperty('closeModal')) {
        ops.closeModal = false
      }
      this.dialogOptions = Object.assign(this.dialogOptions, ops, { visible: true, title: '执行工作台' })
      this.$emit('update:visible', true)
      this.show = true
    },
    closeDialog() {
      this.$emit('update:visible', false)
      this.show = false
      this.$emit('close')
      this.dialogOptions = Object.assign(this.dialogOptions, DIALOG_OPTIONS)
    },
    handleClose(done) {
      this.closeDialog()
      done()
    },
  },
}
